<template>
  <div class="container">
    <Category title="食物">
      <img src="../public/images/food.jpg" />
    </Category>
    <Category title="游戏">
      <!-- (1) 复习了下 index 是直接写在item后面的 -->
      <ul>
        <li v-for="(g, index) in games" :key="index">{{ g }}</li>
      </ul>
    </Category>
    <Category title="电影">
      <video
        src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4"
        controls
      ></video>
    </Category>
  </div>
</template>

<script>
import Category from "./components/Category";

export default {
  name: "myTest",
  data() {
    return {
      foods: ["烤肉", "火锅", "小龙虾", "烤鱼"],
      games: ["王者荣耀", "锈湖", "生化危机"],
      films: ["阿凡达2", "变形金刚", "哥你好", "战狼"],
    };
  },
  components: { Category },
};
</script>

<style scoped>
.container {
  display: flex;
  justify-content: space-around;
}

/* (2) 注意插槽的样式即可以写在 当前组件内传递数据的文件 也可以写在插槽所在文件内
       一个是解析好了一起传过去，另一个是传过去再解析样式
*/
img {
  width: 100%;
}

video {
  width: 100%;
}
</style>
